package cn.gson.oasys.service;

import cn.gson.oasys.mapper.AoaUserMapper;
import cn.gson.oasys.pojo.AoaUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by ASUS on 2020/11/26.
 * lwx1
 */
@Service
public class AoaUserService {
    //验证登录
    @Resource
    private AoaUserMapper aoaUserMapper;

    //刘雯欣 登录
    public AoaUser getByNameAndPassword(String userName,String password) {
        return aoaUserMapper.getByNameAndPassword(userName,password);
    }

    //根据部门查询 部门下的所有人的用户名、真实名、职位--WJN
    public List<AoaUser> getAllUserByDepeId(Integer deptId) {
        return aoaUserMapper.getAllUserByDepeId(deptId);
    }

    //查询全部员工 分页显示 模糊查询 --》WJN
    public List<AoaUser> getAllAoaUser(@Param("deptName") String deptName,
                                       @Param("realName") String realName,
                                       @Param("userName") String userName,
                                       @Param("roleName") String roleName,
                                       @Param("userTel") String userTel,
                                       @Param("salary") Float salary) {
        return aoaUserMapper.getAllAoaUser(deptName,realName,userName,roleName,userTel,salary);
    }

    //新增员工 --》WJN
    public int addAoaUser(AoaUser aoaUser) {
        return aoaUserMapper.addAoaUser(aoaUser);
    }

    //根据userId 查询 用于修改表单绑定值--》WJN
    public AoaUser getByUserId(Long userId) {
        return aoaUserMapper.getByUserId(userId);
    }

    //根据 userId 修改user数据--》WJN
    public int updateUserId(AoaUser aoaUser) {
        return aoaUserMapper.updateUserId(aoaUser);
    }

    //根据 userId 删除user数据--》WJN
    public int deleteAoaUser(Long userId) {
        return aoaUserMapper.deleteAoaUser(userId);
    }

}
